package jpg1980.gttunes.actions;

import java.util.List;

import jpg1980.gttunes.beans.TuneBasic;
import jpg1980.gttunes.beans.TuneFilter;
import jpg1980.gttunes.dao.DaoFactory;
import jpg1980.gttunes.dao.TuneBasicDao;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.ActionSupport;

public class TuneAction extends ActionSupport
{
	private static final long serialVersionUID = 1L;

	static Logger logger = Logger.getLogger(TuneAction.class);

	List<TuneBasic> tuneBasicList;
	
	String driveTrainName;
	String ppRange;
	String carModelName;
	String manufacturerName;

	public String gotoTunesGrid()
	{
		return "goto_tunes_grid";
	}

	public String jsonList()
	{
		TuneBasicDao tuneBasicDao = DaoFactory.getDaoFactory().getTuneBasicDao();
		tuneBasicList = tuneBasicDao.readAll();

		return "json_list";
	}
	
	public String jsonListByTuneFilter()
	{
		TuneFilter tuneFilter = new TuneFilter(manufacturerName, carModelName, ppRange, driveTrainName);
		
		TuneBasicDao tuneBasicDao = DaoFactory.getDaoFactory().getTuneBasicDao();
		tuneBasicList = tuneBasicDao.readByTuneFilter(tuneFilter);

		return "json_list";
	}
	
	public String gotoDetail()
	{
		
		return "goto_detail";
	}

	public String getDriveTrainName()
	{
		return driveTrainName;
	}

	public void setDriveTrainName(String driveTrainName)
	{
		this.driveTrainName = driveTrainName;
	}

	public String getPpRange()
	{
		return ppRange;
	}

	public void setPpRange(String ppRange)
	{
		this.ppRange = ppRange;
	}

	public String getCarModelName()
	{
		return carModelName;
	}

	public void setCarModelName(String carModelName)
	{
		this.carModelName = carModelName;
	}

	public String getManufacturerName()
	{
		return manufacturerName;
	}

	public void setManufacturerName(String manufacturerName)
	{
		this.manufacturerName = manufacturerName;
	}
	
	public List<TuneBasic> getTuneBasicList()
	{
		return tuneBasicList;
	}

	public void setTuneBasicList(List<TuneBasic> tuneBasicList)
	{
		this.tuneBasicList = tuneBasicList;
	}

}
